home *** CD-ROM | disk | FTP | other *** search
- /**************************************************************************
- * NetEchoList.c - List all configured Fidonet areas in CNet
- **************************************************************************/
-
- #include "NetEchoList.h"
-
- BOOL CheckConfigured( char *ZeroPath );
- void GetOut ( void );
-
-
- short FidoType=-1;
- char EchoFile[] = "cnet:bbsechos";
- char GenBuff[256];
- struct EchoList Echo1;
- struct MainPort *myp=NULL;
- BOOL ControlRunning=FALSE;
-
- LONG Listed=0;
-
- UBYTE *vers="$VER:v1.0 NetEchoList (03-11-95)";
-
- void main(int argc, char *argv[])
- {
- FILE *fp;
- short xxx=0;
-
- atexit(GetOut);
-
- if( myp = (struct MainPort *)FindPort("cnetport") )
- {
- ControlRunning=TRUE;
-
- printf("\nAvailable networks:\n\n");
- for(xxx=0;((xxx<myp->gc.nfido) && strlen(myp->gc.fido[xxx].Name));xxx++)
- {
- printf(" %d. %s\n", xxx+1, myp->gc.fido[xxx].Name);
- }
- if(xxx > 0)
- {
- printf("\nChoose a network [RETURN/ENTER = ALL]: ");
- fflush(stdout);
- FidoType=-1;
- if(gets(GenBuff))
- {
- FidoType = atoi(GenBuff)-1;
- printf("%c", 12); /* clear screen */
- }
- }
- }
- else
- {
- printf("\nNote: Base0/Net-type listing disabled while CNet/Control not loaded\n");
- }
-
- if(fp=fopen(EchoFile, "r"))
- {
- if(FidoType == -1)
- {
- printf("\nConfigured echos Fido Type In Base0?\n");
- }
- else
- {
- printf("\nConfigured echos In Base0?\n");
- }
-
- while(fread((char *)&Echo1.EchoType, sizeof(struct EchoType), 1, fp))
- {
- Echo1.Configured=FALSE;
-
- if(ControlRunning)
- {
- Echo1.Configured = CheckConfigured(Echo1.EchoType.Title);
-
- if(FidoType == -1)
- {
- Listed++;
- printf("%-24.24s [%10.10s ] %-33.33s %s\n", Echo1.EchoType.Title, myp->gc.fido[ Echo1.EchoType.domain ].Name, Echo1.EchoType.Info, (Echo1.Configured) ? "Yes":"No");
- }
- else
- {
- /* Does current echo belong the requested net? */
- if(Echo1.EchoType.domain == FidoType)
- {
- Listed++;
- printf("%-24.24s %-48.48s %s\n", Echo1.EchoType.Title, Echo1.EchoType.Info, (Echo1.Configured) ? "Yes":"No");
- }
- }
- }
- else
- {
- Listed++;
- printf("%-24.24s %-48.48s %s\n", Echo1.EchoType.Title, Echo1.EchoType.Info, "Unknown");
- }
- }
- fclose(fp);
- }
-
- if(!Listed)
- {
- printf("[No match/empty]\n");
- }
- else
- {
- printf("Listed %ld echos\n", Listed);
- }
- exit(0);
- }
-
-
- BOOL CheckConfigured( char *SubDirName )
- {
- struct NewSubboardType *sub1;
- LONG zzz=0;
-
- for(zzz=0;zzz<myp->ns;zzz++)
- {
-
- //printf("comparing subboard %s with %s\n", myp->Subboard[zzz].SubDirName, SubDirName);
-
- if(!stricmp(myp->Subboard[zzz].SubDirName, SubDirName))
- {
- return TRUE;
- }
- }
- return FALSE;
- }
-
-
- void GetOut ( void )
- {
- printf("NetEchoList %5.5s copyright © 1995-1996 MetalSoft.\n", vers+5);
- }
-